package com.atguigu.gmall.order.service;

import com.atguigu.gmall.order.entity.OrderInfo;
import com.atguigu.gmall.order.vo.OrderConfirmVo;
import com.atguigu.gmall.order.vo.ToWareOrderSpiltVo;
import com.atguigu.gmall.order.vo.OrderSubmitVo;

import java.util.List;

/**
 * @Description
 * @Return
 * @Author https://weiranyi.github.io
 * @Date Created in 2022-12-21 09:06
 **/
public interface OrderBizService {
    OrderConfirmVo getOrderConfirmData();

    /**
     * 提交订单
     *
     * @param tradeNo
     * @param orderSubmitVo
     * @return
     */
    Long submitOrder(String tradeNo, OrderSubmitVo orderSubmitVo);

    OrderInfo getOrderInfo(String userId, Long orderId);

    OrderInfo getOrderInfo(String tradeNo);

    /**
     * 订单状态 to 已关闭
     *
     * @param orderId
     * @param userId
     */
    void closeOrder(Long orderId, Long userId);

    /**
     * 订单状态 to 已支付
     *
     * @param userId
     * @param id
     */
    void changeOrderStatusToPayed(Long userId, Long id);

    /**
     * 全库全表扫描，可能出现的情况
     *   - 客服系统：A用户给B用户买了东西，B拿着订单找商城售后
     * @param orderId
     * @return
     */
    OrderInfo getOrderInfo(long orderId);

    /**
     * 修改订单的库存扣减状态
     * @param userId
     * @param id
     * @param status
     */
    void updateOrderDeduceStatus(Long userId, Long id, String status);

    /**
     * 拆分订单
     * @param orderId
     * @param wareSkuMap
     * @return
     */
    List<ToWareOrderSpiltVo> splitOrder(Long orderId, String wareSkuMap);

    Long insertSeckillOrder(OrderInfo orderInfo);
}
